package com.optionexplorer.data;

import java.util.Calendar;
import java.util.Date;

/**
 * Filters call options that have < 0 return (deep in the money)
 * and < 1% downside buffer.
 * @author kgajjala
 *
 */
public class StrikePriceOptionFilter extends BaseOptionFilter {

	private float _priceRange = 10;
	
	public void setPriceRange(float num) {
		this._priceRange = num;
	}
	
	protected boolean doesQualify(StockOption opt) {
		boolean result = true;
		//System.out.println(opt);
		float strikePrice = opt.getStrikePrice();
		float currPrice = opt.getStockPrice();
		float offSet = (currPrice - strikePrice) / currPrice;
		offSet = (offSet < 0) ? (offSet * -1) : offSet;
		offSet *= 100;
		
		//System.out.println("Offset : " + offSet);
		
		if (offSet > this._priceRange) {
			result = false;
			return result;
		}
				
		return result;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {

	}

}
